package com.xpgk.mvc.productSales;

import java.util.List;

import com.jfinal.log.Log;
import com.xpgk.annotation.Table;
import com.xpgk.mvc.base.BaseModel;


/**
 * 产品销售订单表
 * */
@SuppressWarnings("unused")
@Table(tableName = ProductSalesOrder.table_name)
public class ProductSalesOrder  extends  BaseModel<ProductSalesOrder>{
	
	
	private static final Log log = Log.getLog(ProductSalesOrder.class);

	public static final ProductSalesOrder dao = new ProductSalesOrder().dao();
	
	
	/**
	 * 表名称
	 */
	public static final String table_name = "sb_product_sales_order";
	
	/**
	 * 字段描述：主键 字段类型：character varying 长度：32
	 */
	public static final String column_ids = "ids";

	/**
	 * 字段描述：订单编号   字段类型：character varying 长度：20
	 */
	public static final String column_orderNumber= "orderNumber";
	/**
	 * 字段描述：机构id 字段类型：character varying 长度：32
	 */
	public static final String column_organIds = "organIds";
	
	/**
	 * 字段描述：顾客（会员）ids 字段类型：character varying 长度：32
	 */
	public static final String column_customerIds = "customerIds";
	/**
	 * 字段描述：操作员ids  字段类型：character varying 长度：32
	 */
	public static final String column_userIds= "userIds";
	/**
	 * 字段描述：应收款  字段类型：float
	 */
	public static final String column_receivable= "receivable";
	/**
	 * 字段描述：实收款  字段类型：float 
	 */
	public static final String column_proceeds= "proceeds";
	/**
	 * 字段描述：欠款 字段类型：float
	 */
	public static final String column_arrears= "arrears";
	/**
	 * 字段描述：结算方式  字段类型：float
	 */
	public static final String column_paymentWay= "paymentWay";
	/**
	 * 字段描述：订单时间  字段类型：date
	 */
	public static final String column_date= "date";
	/**
	 * 字段描述：更新时间  字段类型：date
	 */
	public static final String column_gxsj= "gxsj";
	/**
	 * 字段描述：该条数据添加人员is  字段类型：character varying 长度：32
	 */
	public static final String column_createId = "createId";
	/**
	 * 字段描述：该条数据添加时间  字段类型：datetime 长度：0
	 */
	public static final String column_createDate = "createDate";
	/**
	 * 字段描述：该条数据更新人员id  字段类型：character varying 长度：100
	 */
	public static final String column_updateId = "upateId";
	/**
	 * 字段描述：该条数据更新时间  字段类型：datetime 长度：0
	 */
	public static final String column_updateDate = "updateDate";
	
	public static final String column_dataStatus = "dataStatus";
	/**
	 * sqlId : sb.productSalesOrder.sleBh 描述：查出当前机构所有订单编号
	 */
	public static final String sqlId_sleBh = "sb.productSalesOrder.sleBh";
	
	
	/**根据顾客ids和机构ids获取欠款订单
	 * 
	 * @param cusIds
	 * @param orgIds
	 * @return
	 */
	public  List<ProductSalesOrder> getProductSalesOrders(String cusIds,String orgIds)
	{	
		String sql="SELECT  *,arrears  newproceeds,0 newarrears  from   sb_product_sales_order   where  customerIds=?  and  organIds=?  and  arrears>0";
		return ProductSalesOrder.dao.find(sql,cusIds,orgIds);
	}
}
